﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace elfam.web.Models
{
    public class Outcome: DomainEntity
    {
        public virtual Income Income { get; set; }
        public virtual int Quantity { get; set; }
        public virtual decimal SellPrice { get; set; }
        public virtual DateTime Date { get; set; }
        public virtual OrderLine OrderLine { get; set; }
        public virtual int Discount { get; set; }

        public Outcome()
        {
            Date = DateTime.Now;
            Discount = 0;
        }

        public virtual decimal SummWithDiscount()
        {
            return SellPrice*Quantity * (1 -((decimal)Discount / 100));
        }

        public virtual decimal Summ()
        {
            return SellPrice * Quantity;
        }

        public virtual decimal Profit()
        {
            return SummWithDiscount() - Income.BuyPrice*Quantity;
        }

        public virtual decimal DiscountSumm()
        {
            return Summ()*((decimal)Discount/100);
        }
    }
}
